/****************************************
 * Copyright (c) 2015 NiuWa.
 * All rights reserved.
 * Created on 2015年4月20日
 * 
 * Contributors:
 * 	   Percy.Lo - initial implementation
 ****************************************/
package com.niuwa.p2p.server.manggoDB.exchange;

import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import com.niuwa.p2p.core.enums.MongoQueueEnum;


/**
 * @title 资金队列查找结果
 *
 * @author Percy.Lo
 * @version 1.0
 * @created 2015年4月20日
 */
public class FundResult implements Cloneable{
	/**
	 * 资金所属队列
	 */
	private MongoQueueEnum queue;
	
	/**
	 * 资金详情
	 */
	private DBObject fund;
	
	/**
	 * 资金的有效性,临时计算使用(小于10元后标记为无效)
	 */
	private boolean enable=true;
	
	public FundResult(MongoQueueEnum queue, DBObject fund) {
		this.queue = queue;
		this.fund = fund;
	}

	public MongoQueueEnum getQueue() {
		return queue;
	}

	public DBObject getFund() {
		return fund;
	}
	
	private void setFund(DBObject fund) {
		this.fund = fund;
	}
	
	public boolean isEnable() {
		return enable;
	}

	public void setEnable(boolean enable) {
		this.enable = enable;
	}

	@Override
	public String toString() {
		return this.hashCode()+"-->[queue:"+queue+", enable："+enable+", fund:"+fund+"]";
	}
	
	@Override
	public FundResult clone() throws CloneNotSupportedException {
		FundResult o = (FundResult) super.clone();
		//深克隆
		DBObject fo=new BasicDBObject();
		fo.putAll(fund);
		o.setFund(fo);
		return o;
	}
}
